package com.cssl.controller;

import com.cssl.feinclient.GoodsClient;
import com.cssl.pojo.Goods;
import com.cssl.pojo.Users;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
public class GoodsController {

    @Autowired
    private GoodsClient client;

    @GetMapping("/bxx/index_findAll")
    public List<Goods> findAll() {
        return client.findAll();
    }

    @GetMapping("/bxx/index_findByType")
    public List<Goods> findByType(Integer t_id) {
        System.out.println("findByType:" + t_id);
        return client.findByType(t_id);
    }

    @GetMapping("/bxx/shop_findByType")
    public List<Goods> findByType2(Integer t_id, String order) {
        return client.findByType2(t_id, order);
    }

    @GetMapping("/bxx/shop-detail_findByType")
    public List<Goods> findByType1(Integer t_id) {
        System.out.println("findByType:" + t_id);
        return client.findByType1(t_id);
    }

    @GetMapping("/bxx/index_findById")
    public Goods findById(Integer gid) {
        return client.findById(gid);
    }

    @GetMapping("/bxx/daily_push")
    public List<Goods> daily_push() {
        return client.daily_push();
    }

    @GetMapping("/bxx/shop_findAll")
    public List<Goods> shop_findAll(@RequestParam String order) {
        System.out.println("initGoods");
        return client.shop_findAll(order);
    }

    @GetMapping("/bxx/shop_changeOrder")
    public List<Goods> shop_changeOrder(@RequestParam String order) {
        return client.shop_changeOrder(order);
    }

    @GetMapping("/bxx/shop_getPages")
    public Integer shop_getPages() {
        System.out.println("getPages");
        return client.shop_getPages();
    }

    @PostMapping("/bxx/shop_mainSerch")
    public List<Goods> shop_mainSerch(@RequestParam Map<String, Object> map) {
        return client.shop_mainSerch(map);
    }
}
